import 'package:flutter/material.dart';

void main() {
  runApp(MaterialApp(
    home: Scaffold(
      appBar: AppBar(
        title: const Text("这里是标题"),
      ),
      body: const HomePage2(),
    ),
  ));
}

//容器组件
class HomePage extends StatelessWidget {
  const HomePage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Center(
      child: Container(
        alignment: Alignment.center,
        width: 200,
        height: 200,
        // color: Colors.red,
        decoration: BoxDecoration(
            gradient: const LinearGradient(colors: [Colors.red, Colors.orange]),
            boxShadow: const [
              BoxShadow(
                  color: Colors.blue,
                  offset: Offset(2.0, 2.0),
                  blurRadius: 10.0),
              BoxShadow(
                  color: Colors.green,
                  offset: Offset(2.0, 2.0),
                  blurRadius: 10.0)
            ],
            border: Border.all(color: Colors.black, width: 1)),

        child: const Text(
          "这里是内容",
          textDirection: TextDirection.ltr,
        ),
      ),
    );
  }
}



class HomePage2 extends StatelessWidget {
  const HomePage2({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Center(
      child: Container(
        alignment: Alignment.center,
        height: 40,
        width: 200,
        decoration:  BoxDecoration(
            color: Colors.blue,
            borderRadius: BorderRadius.circular(15)
        ),
        child: const Text(
          "按钮",
          style: TextStyle(fontSize: 20),
        ),
      ),
    );
  }
}